<template>
	<view class="vie">
		<view class="vie_Top">
			<text class="cuIcon-list"></text>
			<text>我的观看记录</text>
		</view>
		<view class="vie_content" v-for="item in viewing" @click="seeVideo(item.resourceId)" :key="item.resourceId">
			<view class="vie_img">
				<text class="cuIcon-videofill"></text>
				<image :src="item.thumbnail" mode="aspectFill" class="image data-v-0034d6f4">
				</image>
			</view>
			<view class="vie_info">
				<view class="vie_title">
					{{item.name}}
				</view>
				<view class="vie_time">
					{{item.lastTime}}
				</view>
			</view>
		</view>
		<view class="vie_Botm" v-show="isShow">
			<text class="line_botm"></text>
			<text class="botm_text">没有更多了</text>
			<text class="line_botm"></text>
		</view>
	</view>
</template>

<script>
	import http from "@/utils/http.js"
	export default {
		data() {
			return {
				viewing: [],
				current: 1, //页码
				size: 10, //每页大小
				isShow: false
			}
		},
		created() {
			this.initVie()
		},
		onReachBottom() {
			if (this.isShow) {
				return false
			}
			this.current++;
			this.initVie()
		},
		methods: {
			initVie() {
				var params = {
					url: `/film/playRecord/u/filmPlayRecordPage`,
					method: 'GET',
					data: {
						size: this.size,
						current: this.current
					},
					callBack: (res) => {
						this.viewing.push(...res.data.records)
						if (res.data.records < this.size) {
							this.isShow = true
						}
					}
				};
				http.request(params);
			},
			seeVideo(resourceId) {
				uni.navigateTo({
					url: `/pages/filmVideo/filmVideo?resourceId=${resourceId}`,
				})
			},
		}
	}
</script>

<style>
	@import "@/colorui/icon.css";

	/* @import "colorui/icon.css"; */
	.vie {
		min-height: 100vh;
		background-color: #31334a;
	}

	.vie_Top {
		display: flex;
		align-items: center;
		font-size: 14px;
		color: #fff;
		padding: 10px;
	}

	.cuIcon-list {
		margin-right: 10px;
		font-size: 16px;
	}

	.vie_Botm {
		padding: 10px 0;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #ccc;
	}

	.line_botm {
		height: 1px;
		width: 15%;
		border-bottom: 1px solid #ccc;
	}

	.botm_text {
		margin: 0 10px;
	}

	.vie_content {
		padding: 5px 10px;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #fff;
	}

	.vie_img {
		position: relative;
		margin-right: 10px;
		width: 50%;
		height: 80px;
		border-radius: 10px;
		overflow: hidden;
	}

	.cuIcon-videofill {
		position: absolute;
		left: 50%;
		top: 50%;
		font-size: 36px;
		color: #000;
		z-index: 1;
		transform: translate(-50%, -50%);
	}

	image {
		width: 100%;
		height: 100%;
	}

	.vie_info {
		width: 50%;
	}

	.vie_title {
		margin-bottom: 10px;
	}

	.vie_time {
		font-size: 12px;
	}
</style>
